package com.tju.resource.server.impl;

import com.tju.resource.mapper.SysVersionsMapper;
import com.tju.resource.model.SysVersions;
import com.tju.resource.server.SysVerService;
import com.tju.resource.tool.tool.QuickQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysVerServiceImpl implements SysVerService {

    @Autowired
    SysVersionsMapper mapper;

    @Override
    public List<SysVersions> verList() {
        return QuickQuery.list(mapper, QuickQuery.params(), "id", false);
    }

    @Override
    public SysVersions curVer() {
        return QuickQuery.byOne(mapper, "current", 1);
    }

    @Override
    public SysVersions newVer() {
        return QuickQuery.list(mapper, QuickQuery.params(), "id", true).get(0);
    }
}
